<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8"/>
    <link rel="stylesheet" th:href="@{/layui/layui.css}"  media="all" />
    <script th:src="@{/layui/layui.all.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/jquery-3.2.1.js}"></script>

    <title>Title</title>

    <style>
        .out_bg {
            position: absolute;
            top: 0;
            opacity: 0.4;
            background-color: black;
            z-index: 3;
            width: 100%;
        }
        /*#msg{
            position: fixed;
            top: 20%;
            left: 50%;
            background-color: white;
            z-index: 4;
            width: 200px;
            height: 100px;
        }*/
    </style>

</head>
<body>
<!--轮播图片-->
<div class="layui-carousel" id="test12">
    <div carousel-item="">
        <div><img src="image/lun.jpg" width="100%" height="100%"/></div>
        <div><img src="image/lun2.jpg" width="100%" height="100%"/></div>
        <div><img src="image/13.jpg" width="100%" height="120%"/></div>
    </div>
</div>
<script>
    layui.use('carousel', function () {
        var carousel = layui.carousel;
        //建造实例
        carousel.render({
            elem: '#test12'
            , width: '100%' //设置容器宽度
            , arrow: 'none' //始终显示箭头
            , width: '1080px'
            , height: '150px'
            //,anim: 'updown' //切换动画方式
        });
    });
</script>
<fieldset class="layui-elem-field layui-field-title" >
    <legend><span class="" style="font-size: 14px">
        <a href="/dor/indexdemo">首页<span class="layui-box">&gt;</span></a>
  <span>投票<span class="layui-box">&gt;</span></span>
  <span>发布投票<span class="layui-box">&gt;</span></span>
</span>
    </legend>
</fieldset>

<input id="isOut" type="text" th:value="${isOut}" hidden="hidden" />

<form class="layui-form" action="/dor/VT" method="post" style="width:80%;">
    <div class="layui-form-item">
        <label class="layui-form-label">投票主题</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input linksName"  name="title" lay-verify="required" required="required"  placeholder="请输入投票主题"/>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
        <label class="layui-form-label">开始日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="startTime"  autocomplete="off"  required="required" lay-verify="required"
                  id="test2"/>
            </div>
    </div>
        <div class="layui-inline">
            <label class="layui-form-label">截止日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="stopTime"  autocomplete="off" lay-verify="required"  required="required"  id="test1"/>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">投票描述</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入投票描述" class="layui-textarea" name="descript"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addLinks">立即发布</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<div class="out_bg" hidden="hidden"></div>
<div id="msg" hidden="hidden">
    <div>提示</div>
    <div>已发布过</div>
    <div>
        <button>确定</button>
    </div>
</div>

<script >
//时间选择
  layui.use('laydate', function(){
      var laydate = layui.laydate;
    laydate.render({
        elem: '#test1'
        ,format: 'yyyy/MM/dd'
    });
  });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test2'
            ,format: 'yyyy/MM/dd'
        });
    });

    var isOut = $('#isOut').val();
    if (isOut == 'true') {
        var height = $(document).height();
        $('.out_bg').css('height', height);
        $('.out_bg').show();
//        $('#msg').show();
        /*l*/

        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                title: '提示'
                ,content: '存在还未过期的投票'
                ,btn: ['前往查看']
                ,yes: function(index, layero){
                    window.location.replace('/dor/voteLook');
                }
            });
        });
    }

</script>
<script th:inline="javascript">
    var flag = [[${flag}]];
    if (flag === 1){
        layer.open({
            content: '发布成功'
        });
        $.get('/dor/VCDL',function (data) {
           /* alert(data)*/
        })
        $.get('/dor/VCDC',function (data) {
            /*alert(data)*/
        })

    }
</script>
</body>
</html>